package com.trsjh.db.domains;
// Generated 2012-1-13 12:55:11 by Hibernate Tools 3.4.0.CR1


import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * Customer generated by hbm2java
 */
@Entity
@Table(name="customers"
    ,catalog="myglass"
    , uniqueConstraints = @UniqueConstraint(columnNames="phone") 
)
public class Customer  implements java.io.Serializable {

    /**
	 * 
	 */
	private static final long serialVersionUID = 5811237313994218646L;
	@Id @GeneratedValue(strategy=IDENTITY)
   @Column(name="id", unique=true, nullable=false)
     private Integer id;
     /**
      * 手机号，可以绑定多个子帐号
      */
    @Column(name="phone", unique=true, nullable=false, length=20)
     private String phone;
     /**
      * 子帐号
      */
    @OneToMany(fetch=FetchType.LAZY, mappedBy="customer")
     private Set<CustomerAccount> customerAccounts = new HashSet<CustomerAccount>(0);

    public Customer() {
    }

	
    public Customer(String phone) {
        this.phone = phone;
    }
    public Customer(String phone, Set<CustomerAccount> customerAccountses) {
       this.phone = phone;
       this.customerAccounts = customerAccountses;
    }
   
    public Integer getId() {
        return this.id;
    }
    
    public void setId(Integer id) {
        this.id = id;
    }

    

    public String getPhone() {
        return this.phone;
    }
    
    public void setPhone(String phone) {
        this.phone = phone;
    }


	public Set<CustomerAccount> getCustomerAccounts() {
		return customerAccounts;
	}


	public void setCustomerAccounts(Set<CustomerAccount> customerAccounts) {
		this.customerAccounts = customerAccounts;
	}






}


